﻿using Common.EF.Utils;
using Common.Infrastructure;
using System.Linq;

namespace Common.EF.Structs
{
    public class CommonContextParamForDI : CommonContextParam
    {
        public CommonContextParamForDI()
        {
            var s = CommonContextParamCache.DefaultParam;
            if (s == null)
            {
                var ret = ContextInitUtils.GetContextParamConfig(null);
                s = ret.FirstOrDefault(t => t.ContextType == ContextTypeEnum.DefaultContext);
                CommonContextParamCache.DefaultParam = s;
            }

            if (s != null)
            {
                LibSysUtils.CopyObject(this, s);
            }
        }
    }
}
